package cn.itcast.nems.journal.dto;

import cn.itcast.nems.common.QueryParam;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Data
@NoArgsConstructor
public class JournalRenewalLineDTO implements Serializable, QueryParam,Comparable<JournalRenewalLineDTO> {
    /**
     * 升级凭单行ID
     */
    private String id ;
    /**
     * 升班凭单ID
     */
    private String journalRenewalId;
    /**
     * 需要升班的基础班学籍ID
     */
    private String originStudentRecordId;
    /**
     * 升班的就业班学籍ID
     */
    private String targetStudentRecordId;

    /**
     * 学员ID
     */
    private Integer studentId;
    /**
     * student 表  学籍号
     */
    private String studentNumber ;

    /**
     * 出班结算日期;退学、转班、进待定班、结课等出班的操作都应记录该值。
     */
    private LocalDateTime settlementDate;

    /**
     * 班级预计结课时间
     */
    private LocalDate predictionGraduationDate;

    /**
     * 开班时间
     */
    private LocalDate startDate;

    /**
     * 学员姓名
     */
    private String name ;
    /**
     * 需要升班的基础班ID
     */
    private Integer originClazzId;
    /**
     * 需要升班的基础班名称
     */
    private String originClazzName;
    /**
     * 需要升班的基础班出班日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDate originClazzOutDate;
    /**
     * 升班目标就业班购买原始金额
     */
    private BigDecimal targetClazzOriginalAmount;
    /**
     * 升班目标就业班优惠金额合计
     */
    private BigDecimal targetClazzDiscountAmount;
    /**
     * 升班目标就业班应付金额
     */
    private BigDecimal targetClazzAmountDue;
    /**
     * 升班目标班级预计入班日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDate targetClazzInDate;
    /**
     * 行优惠项
     */
    private List<JournalRenewalLineDiscountDTO> discountList ;

    /**
     *  优惠券列表
     */
    private List<JournalRenewalLineDiscountDTO> discountCouponList ;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createdDatetime ;

    /**
     * 订单ID
     */
    private String orderId;
    /**
     * 状态;枚举值：待生效｜PENDING、生效｜VALID、已失效| INVALID
     */
    private String studentRecordState ;

    /**
     * 进班日期;未生效学籍不存在进班日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime inDate;

    @Override
    public int compareTo(JournalRenewalLineDTO o) {
        return this.getCreatedDatetime().compareTo(o.getCreatedDatetime());
    }

}